<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Collision Checker: cpp/collision/include/collision/raytrace_primitive.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Collision Checker
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_df511e5bd85cec96854b39d5e1c27aa8.html">cpp</a></li><li class="navelem"><a class="el" href="dir_bf0f0c8865c1942e08ab5157e2c596db.html">collision</a></li><li class="navelem"><a class="el" href="dir_0695118b3b27d100933d16472a5a2e05.html">include</a></li><li class="navelem"><a class="el" href="dir_d28884e0e9991dd74831dd1628ef4f1a.html">collision</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">raytrace_primitive.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="raytrace__primitive_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * raytrace_primitive.h</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> *  Created on: Oct 29, 2018</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *  Author: Vitaliy Rusinov</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#ifndef CPP_COLLISION_RAYTRACE_PRIMITIVE_H_</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#define CPP_COLLISION_RAYTRACE_PRIMITIVE_H_</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;cmath&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;Eigen/Dense&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacecollision.html">collision</a> {</div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="namespacecollision_1_1raytrace.html">   17</a></span>&#160;<span class="keyword">namespace </span>raytrace {</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">using namespace </span>std;</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="structcollision_1_1raytrace_1_1_point.html">   21</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structcollision_1_1raytrace_1_1_point.html">Point</a> {</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;  <a class="code" href="structcollision_1_1raytrace_1_1_point.html">Point</a>();</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;  <a class="code" href="structcollision_1_1raytrace_1_1_point.html">Point</a>(<span class="keyword">const</span> Eigen::Vector2d &amp;pnt);</div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="structcollision_1_1raytrace_1_1_point.html#a569322759d29989a357eafd9f376304d">   25</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="structcollision_1_1raytrace_1_1_point.html#a569322759d29989a357eafd9f376304d">x</a>;</div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="structcollision_1_1raytrace_1_1_point.html#a75ada217adbe221af6bdb23a173c7d64">   26</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="structcollision_1_1raytrace_1_1_point.html#a75ada217adbe221af6bdb23a173c7d64">y</a>;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;  <a class="code" href="structcollision_1_1raytrace_1_1_point.html">Point</a>(<span class="keyword">const</span> <a class="code" href="structcollision_1_1raytrace_1_1_point.html">Point</a> &amp;);</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="structcollision_1_1raytrace_1_1_point.html#a3c51cac43e6ef6132ba746966218098c">   29</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="structcollision_1_1raytrace_1_1_point.html#a3c51cac43e6ef6132ba746966218098c">getCoord</a>(<span class="keywordtype">int</span> axis)<span class="keyword"> const </span>{</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <span class="keywordflow">if</span> (!axis)</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;      <span class="keywordflow">return</span> x;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="keywordflow">else</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;      <span class="keywordflow">return</span> y;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;  }</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;};</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacecollision_1_1raytrace.html#aa5d0e3bbe5db32786c5562a886ddba67">RaytraceDebugOutput</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacecollision_1_1raytrace.html#a8f655b21b0063c7b37865a4a89e358f0">RaiseRaytraceError</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="keywordtype">bool</span> <a class="code" href="namespacecollision_1_1raytrace.html#a025bf0f171abcc1cf7bbee6c4a41bba3">onSegment</a>(<a class="code" href="classcollision_1_1_point.html">Point</a> p, <a class="code" href="classcollision_1_1_point.html">Point</a> q, <a class="code" href="classcollision_1_1_point.html">Point</a> r);</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="keywordtype">int</span> <a class="code" href="namespacecollision_1_1raytrace.html#a6131dea50f0b53336b6f535167ad90ab">orientation</a>(<a class="code" href="classcollision_1_1_point.html">Point</a> p, <a class="code" href="classcollision_1_1_point.html">Point</a> q, <a class="code" href="classcollision_1_1_point.html">Point</a> r);</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespacecollision_1_1raytrace.html#a60df465f132c196bdb339595739e7229">det</a>(<span class="keywordtype">double</span> a, <span class="keywordtype">double</span> b, <span class="keywordtype">double</span> c, <span class="keywordtype">double</span> d);</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="keywordtype">bool</span> <a class="code" href="namespacecollision_1_1raytrace.html#a8f02f6781a2c5c86af568cc136f999f0">lineLineIntersect</a>(<span class="keywordtype">double</span> x1, <span class="keywordtype">double</span> y1,          <span class="comment">// Line 1 start</span></div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;                       <span class="keywordtype">double</span> x2, <span class="keywordtype">double</span> y2,          <span class="comment">// Line 1 end</span></div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;                       <span class="keywordtype">double</span> x3, <span class="keywordtype">double</span> y3,          <span class="comment">// Line 2 start</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;                       <span class="keywordtype">double</span> x4, <span class="keywordtype">double</span> y4,          <span class="comment">// Line 2 end</span></div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;                       <span class="keywordtype">double</span> &amp;ixOut, <span class="keywordtype">double</span> &amp;iyOut); <span class="comment">// Output</span></div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="keywordtype">int</span> <a class="code" href="namespacecollision_1_1raytrace.html#ad60325650aba6f3ce8fd4eb92cad44c1">findLineCircleIntersections</a>(<span class="keywordtype">double</span> cx, <span class="keywordtype">double</span> cy, <span class="keywordtype">double</span> radius,</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;                                <span class="keyword">const</span> Eigen::Vector2d &amp;p1,</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;                                <span class="keyword">const</span> Eigen::Vector2d &amp;p2,</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;                                std::vector&lt;Eigen::Vector2d&gt; &amp;inters);</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="keywordtype">bool</span> <a class="code" href="namespacecollision_1_1raytrace.html#a9b179e024ada71f8f3197d7a514bcb82">doIntersect</a>(<a class="code" href="classcollision_1_1_point.html">Point</a> p1, <a class="code" href="classcollision_1_1_point.html">Point</a> q1, <a class="code" href="classcollision_1_1_point.html">Point</a> p2, <a class="code" href="classcollision_1_1_point.html">Point</a> q2,</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;                 std::vector&lt;Point&gt; &amp;inters);</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;} <span class="comment">// namespace raytrace</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;} <span class="comment">// namespace collision</span></div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* CPP_COLLISION_RAYTRACE_PRIMITIVE_H_ */</span><span class="preprocessor"></span></div><div class="ttc" id="namespacecollision_1_1raytrace_html_a8f02f6781a2c5c86af568cc136f999f0"><div class="ttname"><a href="namespacecollision_1_1raytrace.html#a8f02f6781a2c5c86af568cc136f999f0">collision::raytrace::lineLineIntersect</a></div><div class="ttdeci">bool lineLineIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double &amp;ixOut, double &amp;iyOut)</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8cc_source.html#l00101">raytrace_primitive.cc:101</a></div></div>
<div class="ttc" id="namespacecollision_1_1raytrace_html_a8f655b21b0063c7b37865a4a89e358f0"><div class="ttname"><a href="namespacecollision_1_1raytrace.html#a8f655b21b0063c7b37865a4a89e358f0">collision::raytrace::RaiseRaytraceError</a></div><div class="ttdeci">void RaiseRaytraceError(const char *)</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8cc_source.html#l00065">raytrace_primitive.cc:65</a></div></div>
<div class="ttc" id="structcollision_1_1raytrace_1_1_point_html_a3c51cac43e6ef6132ba746966218098c"><div class="ttname"><a href="structcollision_1_1raytrace_1_1_point.html#a3c51cac43e6ef6132ba746966218098c">collision::raytrace::Point::getCoord</a></div><div class="ttdeci">double getCoord(int axis) const</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8h_source.html#l00029">raytrace_primitive.h:29</a></div></div>
<div class="ttc" id="namespacecollision_1_1raytrace_html_ad60325650aba6f3ce8fd4eb92cad44c1"><div class="ttname"><a href="namespacecollision_1_1raytrace.html#ad60325650aba6f3ce8fd4eb92cad44c1">collision::raytrace::findLineCircleIntersections</a></div><div class="ttdeci">int findLineCircleIntersections(double cx, double cy, double radius, const Eigen::Vector2d &amp;p1, const Eigen::Vector2d &amp;p2, std::vector&lt; Eigen::Vector2d &gt; &amp;inters)</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8cc_source.html#l00025">raytrace_primitive.cc:25</a></div></div>
<div class="ttc" id="structcollision_1_1raytrace_1_1_point_html"><div class="ttname"><a href="structcollision_1_1raytrace_1_1_point.html">collision::raytrace::Point</a></div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8h_source.html#l00021">raytrace_primitive.h:21</a></div></div>
<div class="ttc" id="namespacecollision_1_1raytrace_html_a60df465f132c196bdb339595739e7229"><div class="ttname"><a href="namespacecollision_1_1raytrace.html#a60df465f132c196bdb339595739e7229">collision::raytrace::det</a></div><div class="ttdeci">double det(double a, double b, double c, double d)</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8cc_source.html#l00097">raytrace_primitive.cc:97</a></div></div>
<div class="ttc" id="namespacecollision_1_1raytrace_html_aa5d0e3bbe5db32786c5562a886ddba67"><div class="ttname"><a href="namespacecollision_1_1raytrace.html#aa5d0e3bbe5db32786c5562a886ddba67">collision::raytrace::RaytraceDebugOutput</a></div><div class="ttdeci">void RaytraceDebugOutput(const char *)</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8cc_source.html#l00059">raytrace_primitive.cc:59</a></div></div>
<div class="ttc" id="namespacecollision_1_1raytrace_html_a025bf0f171abcc1cf7bbee6c4a41bba3"><div class="ttname"><a href="namespacecollision_1_1raytrace.html#a025bf0f171abcc1cf7bbee6c4a41bba3">collision::raytrace::onSegment</a></div><div class="ttdeci">bool onSegment(Point p, Point q, Point r)</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8cc_source.html#l00073">raytrace_primitive.cc:73</a></div></div>
<div class="ttc" id="namespacecollision_html"><div class="ttname"><a href="namespacecollision.html">collision</a></div><div class="ttdef"><b>Definition:</b> <a href="collision__checker_8h_source.html#l00020">collision_checker.h:20</a></div></div>
<div class="ttc" id="namespacecollision_1_1raytrace_html_a9b179e024ada71f8f3197d7a514bcb82"><div class="ttname"><a href="namespacecollision_1_1raytrace.html#a9b179e024ada71f8f3197d7a514bcb82">collision::raytrace::doIntersect</a></div><div class="ttdeci">bool doIntersect(Point p1, Point q1, Point p2, Point q2, std::vector&lt; Point &gt; &amp;inters)</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8cc_source.html#l00137">raytrace_primitive.cc:137</a></div></div>
<div class="ttc" id="structcollision_1_1raytrace_1_1_point_html_a569322759d29989a357eafd9f376304d"><div class="ttname"><a href="structcollision_1_1raytrace_1_1_point.html#a569322759d29989a357eafd9f376304d">collision::raytrace::Point::x</a></div><div class="ttdeci">double x</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8h_source.html#l00025">raytrace_primitive.h:25</a></div></div>
<div class="ttc" id="namespacecollision_1_1raytrace_html_a6131dea50f0b53336b6f535167ad90ab"><div class="ttname"><a href="namespacecollision_1_1raytrace.html#a6131dea50f0b53336b6f535167ad90ab">collision::raytrace::orientation</a></div><div class="ttdeci">int orientation(Point p, Point q, Point r)</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8cc_source.html#l00086">raytrace_primitive.cc:86</a></div></div>
<div class="ttc" id="structcollision_1_1raytrace_1_1_point_html_a75ada217adbe221af6bdb23a173c7d64"><div class="ttname"><a href="structcollision_1_1raytrace_1_1_point.html#a75ada217adbe221af6bdb23a173c7d64">collision::raytrace::Point::y</a></div><div class="ttdeci">double y</div><div class="ttdef"><b>Definition:</b> <a href="raytrace__primitive_8h_source.html#l00026">raytrace_primitive.h:26</a></div></div>
<div class="ttc" id="classcollision_1_1_point_html"><div class="ttname"><a href="classcollision_1_1_point.html">collision::Point</a></div><div class="ttdoc">A point in space.</div><div class="ttdef"><b>Definition:</b> <a href="point_8h_source.html#l00018">point.h:18</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
